/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-04-22
 * Time: 20:13
 */
public class Test {
    public static void main(String[] args) {

        char[] ch = new char[]{'a','b','c','d'};
        String a2 = new String(ch);
        a2.intern();
        String a1 = "abcd";
        String a3 = "abcd";
        String a4 = new String(ch);
        System.out.println(a1 == a2);//ture
        System.out.println(a1 == a3);//ture
        System.out.println(a1 == a4);//false

    }
    /**public static void main1(String[] args) {
        String a1 = "abcd";
        String a2 = new String("abcd");
        String a3 = "abcd";
        char[] ch = {'a','b','c','d'};
        String a4 = new String(ch);
        System.out.println(a1 == a2);//false
        System.out.println(a1 == a3);//ture
        System.out.println(a1 == a4);//false

    }*/
}
